-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update fastapi & pydantic #429
Conversation
Pydantic v2 has a number of breaking changes. Also see #428
QUERY_VALIDATOR_LOAD_VERSION_OVERRIDE = Annotated[str | None, Query( | ||
QUERY_VALIDATOR_LOAD_VERSION_OVERRIDE = Annotated[str, Query( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Path
and Query
components, adding None
to the type annotation causes the input restrictions not to be shown in the OpenAPI documentation. Not sure why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it happen with a Optional[Str] Or Union[] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't try because the current way works well enough for now and I don't want to go back to the Bad Old Ways of type hints
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #429 +/- ##
==========================================
- Coverage 41.46% 41.42% -0.05%
==========================================
Files 67 67
Lines 5496 5492 -4
==========================================
- Hits 2279 2275 -4
Misses 3217 3217
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes look good. But did you test tool runners with pydantic 2? I know at least microtrait is explicitly using pydantic=1.10.12
.
I didn't think of that, but looking at the code changes, they shouldn't break anything since microtrait doesn't actually use the models any more, just the field names. Therefore the imports just need to work. Would it be ok if I asked you to bump pydantic next time you work on the tools? I've literally never run them so testing them is a bit of a pain for me currently (which at some point I need to fix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pydantic v2 has a number of breaking changes.
Also see #428